/*
 * @Author: zheng yong tao
 * @Date: 2021-06-13 02:51:36
 * @LastEditors: zheng yong tao
 * @LastEditTime: 2022-01-03 23:46:11
 * @Description: 
 */
var util = {
	dateFilter:function(val) 
	{
		console.log(val);
		let date = new Date(val),
			Y = date.getFullYear(),
			M = (date.getMonth() + 1 < 10
				? '0' + (date.getMonth() + 1)
				: date.getMonth() + 1),
			D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate(),
			h = date.getHours(),
			m = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes(),
			s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
		return Y + '-' + M + '-' + D + ' ' + h + ':' + m + ':' + s;
	},
	//生成验证码
	tokenGenerator:function(){
		let chars = ['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'],
			res = "";
		for(var i = 0; i < 6 ; i ++) {
		    var id = Math.ceil(Math.random()*35);
		    res += chars[id];
		}
		return res;
	},
	myConsole:function(str){
		console.log(
			`%c JYeontu %c Chrome助手 %c ${str} %c`,
			'background:deepskyblue ; padding: 2px; border-radius: 3px 0 0 3px;  color: #fff',
			'background:skyblue ; padding: 2px; border-radius: 3px 0 0 3px;  color: #fff',
			'background:pink ; padding: 2px; border-radius: 0 3px 3px 0;  color: #fff',
			'background:transparent'
		);
	};
}

module.exports=util;